package com.zshan.clinic.web.controller.config;


import com.zshan.clinic.admin.entity.vo.MedicalFieldGroupVo;
import com.zshan.clinic.admin.entity.vo.MedicalFieldVo;
import com.zshan.clinic.admin.service.config.MedicalFieldService;
import com.zshan.clinic.common.enums.FieldScopeEnum;
import com.zshan.clinic.common.response.RestResp;
import com.zshan.clinic.web.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 病历字段
 */
@RestController
@RequestMapping("/medical/field")
public class MedicalFieldController extends AbstractController {


    @Autowired
    private MedicalFieldService medicalFieldService;

    /**
     * 查询病历字段
     * @param
     * @return
     */
    @GetMapping("/getMedicalFieldList")
    public RestResp<MedicalFieldGroupVo> getMedicalFieldList() {
        MedicalFieldGroupVo fieldList = medicalFieldService.getAllFieldList();
        return RestResp.SUCCESS(fieldList);
    }

    /**
     * 查询患者病历字段
     * @param filedList  ["JWS","GMS"]
     * @return
     */
    @GetMapping("/getPatientMedicalFieldList")
    public RestResp<List<MedicalFieldVo>> getPatientMedicalFieldList(@RequestParam(name = "filedList") List<String> filedList) {
        List<MedicalFieldVo> fieldList = medicalFieldService.getMedicalFieldList(FieldScopeEnum.ALL.getValue(),filedList);
        return RestResp.SUCCESS(fieldList);
    }

}
